<?php
//角色
namespace app\adminbackstage\model;

use think\Model;
/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

class Role_user extends Model{

    // 模型初始化
    protected static function init()
    {
        parent::init();
        //TODO:初始化内容
    }

    

    //角色权限
    public function jurisdiction($where){
        $list = $this::name('role_user')
        ->field('r.id,r.rid,r.uid,m.id as m_id,m.rid as m_rid,m.mid as m_mid,m.r_read,m.r_writ,me.id as meid ,me.superior_id as superior_id ,me.menu_name as menu_name,me.link as link,me.Icon as Icon,me.exhibition as exhibition')
        ->alias('r')
        ->leftJoin('pg_role_menu m','m.rid = r.rid')
        ->leftjoin('pg_menu as  me','me.id = m.mid')
        ->where($where)
        ->order('m.id', 'desc')
        ->select();
        return $list;
    }
    
    
    //admin权限
    public function adminJurisdiction($where){
        $list = $this::name('menu')
        ->where($where)
        ->select();
        return $list;
    }

  
}
